package beautiful.butterfly.drds.data_exchange.statistics.plugin.task.util;

import beautiful.butterfly.drds.data_exchange.exception.DataExchangeException;
import beautiful.butterfly.drds.data_exchange.transport.record.column.Column;
import beautiful.butterfly.drds.data_exchange.transport.record.column.ColumnType;
import beautiful.butterfly.drds.data_exchange.util.FrameworkErrorCode;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;


class DirtyColumn extends Column
{
    @Setter
    @Getter
    private int index;

    private DirtyColumn(Column column, int index)
    {
        this(null == column ? null : column.getObject(),
                null == column ? ColumnType.NULL : column.getColumnType(),
                null == column ? 0 : column.getByteSize(), index);
    }

    private DirtyColumn(Object object, ColumnType columnType, int byteSize, int index)
    {
        super(object, columnType, byteSize);
        this.setIndex(index);
    }

    public static Column asDirtyColumn(final Column column, int index)
    {
        return new DirtyColumn(column, index);
    }


    @Override
    public Boolean asBoolean()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public Long asLong()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public Double asDouble()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public BigDecimal asBigDecimal()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public BigInteger asBigInteger()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public String asString()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public Date asDate()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }

    @Override
    public byte[] asBytes()
    {
        throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.RUNTIME_ERROR,
                "该方法不支持!");
    }


}
